#ifndef STATICPOINTFNC_H_
#define STATICPOINTFNC_H_

#include "Minuit2/FCNGradientBase.h"
#include "StaticPointMinimizeFun.h"
#include <vector>
#include <cassert>

class StaticPointFCN : public ROOT::Minuit2::FCNGradientBase
{
public:
	StaticPointFCN() {}
	StaticPointFCN(const MATHLIB::matrix33& a_surf,
		const MATHLIB::matrix33& a_tool)
	{
		m_minimizeFun.Init(a_surf, a_tool);
		m_errorDef =0.25;
	}

	~StaticPointFCN() {}

	void Init(const MATHLIB::matrix33& a_surf,
		const MATHLIB::matrix33& a_tool)
	{
		m_minimizeFun.Init(a_surf, a_tool);
		m_errorDef =0.25;
	}

	double Up() const { return m_errorDef; }
	double operator()(const std::vector<double>& a_arg) const;
	std::vector<double> Gradient(const std::vector<double>& a_arg) const;
	void SetErrorDef(double errDef) { m_errorDef = errDef; }
	bool CheckGradient() const {return false;}
	
private:
	StaticPointMinimizeFun m_minimizeFun;
	double m_errorDef;
};


#endif //STATICPOINTFNC_H_